﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Tron.DataStructures;

namespace Tron.Players.Simple
{
    static class SimplePlayerHelper
    {
        /// <summary>
        /// Returns the move directions that are possible from the input position.
        /// </summary>
        public static List<Vector2> PossibleDirectionsFromPosition(Percepts percepts, Vector2 position)
        {
            List<Vector2> directionVectors = new List<Vector2>() { Vector2.UnitX, -Vector2.UnitX, Vector2.UnitY, -Vector2.UnitY };

            List<Vector2> possibleDirections = new List<Vector2>();

            foreach (Vector2 directionVector in directionVectors)
            {
                Vector2 nextPosition = position + directionVector;
                if (percepts.Board[nextPosition] == -2)
                {
                    possibleDirections.Add(directionVector);
                }
            }
            return possibleDirections;
        }
    }
}
